<?php

namespace App\Containers\AppSection\Questionnaire\Data\Criterias;

use App\Ship\Parents\Criterias\Criteria;
use Prettus\Repository\Contracts\RepositoryInterface as PrettusRepositoryInterface;

class RequiredFormsCriteria extends Criteria
{
    protected string $legalFormType;

    public function __construct(string $legalFormType)
    {
        $this->legalFormType = $legalFormType;
    }

    public function apply($model, PrettusRepositoryInterface $repository)
    {
        return $model->where('required', true)->where('legal_form_type', $this->legalFormType);
    }
}
